/**
 * Created by Administrator on 2017/8/4.
 */


import React,{Component} from 'react'
import {TouchableOpacity,View,Image, Text,StyleSheet,Dimensions,ToastAndroid} from 'react-native'
import StorageUtils from '../Storage/StorageUtil'
let headerImg = require('../Img/bg_wode_2x.png')
let bc_head = require('../Img/icon.png')
let setImg = require('../Img/icon_shezhi.png')
let xiaoxiImg = require('../Img/icon_xiaoxitongzhi.png')
let checkImg = require('../Img/icon_jiancha.png')
let buchongImg = require('../Img/icon_buchong.png')
let menuImg = require('../Img/icon_qingdan.png')
let boxListImg = require('../Img/icon_liebiao.png')

const ScreenSize = {
    width: Dimensions.get('window').width,
    height: Dimensions.get('window').height
};

const styles = StyleSheet.create({
    headers:{
        height:200,
        width:ScreenSize.width,
        resizeMode:'cover',
    },
    iconImg:{
        width:120,
        height:120,
        borderRadius:60,
        marginTop:50
    },
    itemLl:{
        width:108,
        height:27,
        flexDirection:'row',
        alignItems:'center'
    },
    itemImg:{
        width:27,
        height:27
    },
    itemTv:{
        fontSize:16,
        marginLeft:18
    }
})

export default class Host extends Component{

    static navigationOptions = ({navigation}) => ({
        headerStyle:{
            height:0
        }
    })

    constructor(props){
        super(props)
        this.state = {
            userName:'18328676067'
        }
    }

    componentWillMount() {
        StorageUtils._load('loginresult',(params)=>{
            console.log('a:'+params.data['ww-token'])
            console.log('b:'+params.data.phone)
            this.setState({userName:'操你妈逼'})
        })

    }
    render(){
        const {navigate}  = this.props.navigation
        return(
            <View style={{flex:1,alignItems:'center'}}>
                <Image style={styles.headers} source={headerImg}>
                    <View style={{flexDirection:'row',justifyContent:'space-between', height:25,alignItems:'center',width:ScreenSize.width,marginTop:16}}>
                        <View style={{width:22,height:25}}></View>
                        <Text style={{fontSize:16,color:'#fff'}}>有纸</Text>
                        <TouchableOpacity style={{width:21,height:21, marginRight:16}}
                                          onPress={()=>navigate('UserSet')}>
                            <Image style={{width:21,height:21,resizeMode:'contain'}} source={setImg}/>
                        </TouchableOpacity>
                    </View>
                </Image>
                <Image style={[styles.iconImg,{position:'absolute',zIndex:2,marginTop:110}]} source={bc_head}/>

                <Text style={{fontSize:16,marginTop:40}}>{this.state.userName}</Text>

                <TouchableOpacity style={[styles.itemLl,{marginTop:35}]}
                                  onPress={()=>navigate('Message')}>
                    <Image style={styles.itemImg} source={xiaoxiImg}/>
                    <Text style={styles.itemTv}>消息通知</Text>
                </TouchableOpacity>
                <TouchableOpacity style={[styles.itemLl,{marginTop:35}]}>
                    <Image style={styles.itemImg} source={checkImg}/>
                    <Text style={styles.itemTv}>开柜检查</Text>
                </TouchableOpacity>
                <TouchableOpacity style={[styles.itemLl,{marginTop:35}]}
                                  onPress={()=>navigate('Replenishment')}>
                    <Image style={styles.itemImg} source={buchongImg}/>
                    <Text style={styles.itemTv}>货品补充</Text>
                </TouchableOpacity>
                <TouchableOpacity style={[styles.itemLl,{marginTop:35}]}
                                  onPress={()=>navigate('UserMenuPage')}>
                    <Image style={styles.itemImg} source={menuImg}/>
                    <Text style={styles.itemTv}>我的清单</Text>
                </TouchableOpacity>
                <TouchableOpacity style={[styles.itemLl,{marginTop:35}]}>
                <Image style={styles.itemImg} source={boxListImg}/>
                <Text style={styles.itemTv}>柜子列表</Text>
            </TouchableOpacity>
            </View>
        )
    }
}